﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SerializeUri.cs" company="XamlNinja">
//   2011 Richard Griffin and Ollie Riches
// </copyright>
// <summary>
//   SilverlightSerializer definition for system namespace class - Uri
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace WP7Contrib.Serialization.Helpers
{
    using System;
    using global::Serialization;

    /// <summary>
    /// SilverlightSerializer definition for system namespace class - Uri
    /// </summary>
    [Serializer(typeof(Uri))]
    public sealed class SerializeUri : ISerializeObject
    {
        public object[] Serialize(object target)
        {
            return new object[] { target.ToString() };
        }

        public object Deserialize(object[] data)
        {
            return new Uri((string) data[0]);
        }
    }
}